include( 'shared.lua' )

ENT.RenderGroup = RENDERGROUP_BOTH

function ENT:Draw()
    self.Entity:DrawModel()
end

local function BankMenu()
		local DButton2
		local DButton1
		local DTextEntry1
		local DLabel1
		local DFrame1

		DFrame1 = vgui.Create('DFrame')
		DFrame1:SetSize(228, 194)
		DFrame1:Center()
		DFrame1:SetTitle('Bank ATM')
		DFrame1:SetSizable(true)
		DFrame1:SetDeleteOnClose(false)
		DFrame1:MakePopup()

		DLabel1 = vgui.Create('DLabel')
		DLabel1:SetParent(DFrame1)
		DLabel1:SetPos(13, 41)
		DLabel1:SetText("Welcome to your bank account,\nEnter the values below on how much you\nwan't to withdraw/deposit.")
		DLabel1:SizeToContents()

		DTextEntry1 = vgui.Create('DTextEntry')
		DTextEntry1:SetParent(DFrame1)
		DTextEntry1:SetSize(185, 25)
		DTextEntry1:SetPos(19, 101)
		DTextEntry1:SetText('Enter a number here')

		DButton1 = vgui.Create('DButton')
		DButton1:SetParent(DFrame1)
		DButton1:SetSize(70, 25)
		DButton1:SetPos(16, 148)
		DButton1:SetText('Deposit')
		DButton1.DoClick = function()
		if not tonumber(DTextEntry1:GetValue()) then
		LocalPlayer():ChatPrint("You can only use numbers!")
		end
		LocalPlayer():ConCommand("bank_deposit " .. tonumber(DTextEntry1:GetValue()))
	end

		DButton2 = vgui.Create('DButton')
		DButton2:SetParent(DFrame1)
		DButton2:SetSize(70, 25)
		DButton2:SetPos(120, 148)
		DButton2:SetText('Withdraw')
		DButton2.DoClick = function() 
		if not tonumber(DTextEntry1:GetValue()) then
		LocalPlayer():ChatPrint("You can only use numbers!")
		end
		LocalPlayer():ConCommand("bank_withdraw " .. tonumber(DTextEntry1:GetValue()))
		end
	end
usermessage.Hook("ShowBank", BankMenu)